/*
 * @Author: anshengtyp
 * @Date: 2024-03-27 16:35:22
 * @LastEditTime: 2024-03-28 11:36:12
 * @LastEditors: anshengtyp
 * @Description: 
 */
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import { setToken } from '@/utils/auth'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/es/locale/lang/zh-cn'
import './permission'


import 'cesium/Build/Cesium/Widgets/widgets.css'
import elementIcons from '@/plugins/eleIcon'

const app = createApp(App);

app.use(router);
app.use(elementIcons)

// 处理第三方系统登录，进行预览
function getParamValue(paramName) {
  let regex = new RegExp('[?&]' + paramName + '=([^&#]+)');
  let results = regex.exec(window.location.href);
  return results === null ? null : decodeURIComponent(results[1]);
}

let paramValue = getParamValue('assess_token');
if (paramValue) {
  setToken(paramValue);
  const urlParams = new URLSearchParams(window.location.search);
  const path = "/" + window.location.href.split('/').at(-1).split('?')[0]; // 获取跳转路由Url
  const id = urlParams.get('id');
  const groupId = urlParams.get('groupId');
  router.push({
    path,
    query: {
      id,
      groupId
    }
  });
}


// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
})

app.mount('#app');

